-- @owner: opentestcase003
-- @date: 2022-07-28
-- @testpoint: dense_rank函数测试，dense_rank()作为子查询结合group by-不支持，合理报错

--step1: 创建表；expect:成功
drop table if exists t4_ustore_function_denserank_0059;
create table t4_ustore_function_denserank_0059(col_1 bigint, col_2 timestamp, col_3 bool,col_4 decimal,col_5 clob ,
col_6 interval day to second ,col_7 nchar(30) ,col_8 blob ,col_9 raw(100),col_10 date,
col_11 bytea ,col_12 bytea,col_13 varchar2(800)) with (storage_type=ustore);
drop sequence if exists s_ustore_function_denserank_0059;
create sequence s_ustore_function_denserank_0059 increment by 1 start with 10000;
insert into t4_ustore_function_denserank_0059 values(s_ustore_function_denserank_0059.nextval,to_date('2019-09-05 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784786,lpad('abc','50','a@123&^%djgk'),(interval '4 5:12:10.222' day to second(3)),rpad('abc','30','uegc%^4'),'101001010','0faadb9',to_date('1981-2-20', 'yyyy-mm-dd'),'101001010','01010111111110000000000',lpad('jhafd韩子高各机构测','80','ajge'));
insert into t4_ustore_function_denserank_0059 values(s_ustore_function_denserank_0059.nextval,to_date('2019-09-06 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784787,lpad('abc','55','a@123&^%djgk'),(interval '4 5:12:10.222' day to second(3)),rpad('ab','30','uegc%^4'),'101010101010','0faadb9',to_date('1981-2-21', 'yyyy-mm-dd'),'1001010101010','01010111111110000000001100000',lpad('jhafd韩子高各机构测','82','ajgedf'));
insert into t4_ustore_function_denserank_0059 values(s_ustore_function_denserank_0059.nextval,to_date('2019-09-07 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.141592665735674554784788,lpad('abc','100','a@123&^%djgk'),(interval '4 5:12:10.222' day to second(3)),rpad('abc','29','uegc%^4'),'101010101010','0faadb9',to_date('1981-3-20', 'yyyy-mm-dd'),
'1010100101010','010101111111100000000011100000',lpad('jhafd韩子高各机构测','81','ajge'));
insert into t4_ustore_function_denserank_0059 values(s_ustore_function_denserank_0059.nextval,to_date('2019-09-08 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'false',3.141592665735674554784789,lpad('abc','500','a@123&^%djgk'),(interval '4 5:12:10.222' day to second(3)),rpad('abc','28','uegc%^4'),'1010101001010','0faadb9',to_date('1981-3-21', 'yyyy-mm-dd'),
'10101001010111','010101111111100000000000000',lpad('jhafd韩子高各机构测','185','ajge'));
insert into t4_ustore_function_denserank_0059 values(s_ustore_function_denserank_0059.nextval,to_date('2019-09-05 10:45:42', 'yyyy-mm-dd hh:mi:ss'),'true',3.1415926657356745547847861,lpad('abc','20','a@123&^%djgk'),(interval '4 5:13:10.222' day to second(3)),rpad('abc','30','uegc%^4'),empty_blob(),'0faadb9',to_date('1981-2-20', 'yyyy-mm-dd'),'10101001010','01010111111110000000000',lpad('jhafd韩子h高各机构测','80','ajge'));

--step2: dense_rank函数测试，dense_rank()作为子查询结合group by-不支持；expect:失败
select col_1,col_2,max(col_7),dense_rank() over(partition by col_2 order by col_1,col_7 desc) f1 from t4_ustore_function_denserank_0059 group by cube(col_1,col_2,dense_rank() over(partition by col_2 order by col_1,col_7 desc));
select col_1,col_3,max(col_6),dense_rank() over(partition by col_3 order by col_1,col_6 desc) f1 from t4_ustore_function_denserank_0059 group by rollup(col_1,col_3,dense_rank() over(partition by col_3 order by col_1,col_6 desc));
select col_1,col_2,max(col_7),dense_rank() over(partition by col_2 order by col_1,col_7 desc) f1 from t4_ustore_function_denserank_0059 group by  grouping sets(col_1,col_2,dense_rank() over(partition by col_2 order by col_1,col_7 desc));

--step3: 清理表；expect:成功
drop sequence s_ustore_function_denserank_0059;
drop table t4_ustore_function_denserank_0059;